package com.seashop.feign.fallback;

import com.seashop.feign.ManageFeignClient;
import com.seashop.request.LocalTransRequestParam;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author moredln
 * @desc 管理端调用失败处理
 * @date 2020-11-11 10:31
 */
@Component
@Slf4j
public class ManageFeignClientFallBack implements FallbackFactory<ManageFeignClient> {
    @Override
    public ManageFeignClient create(Throwable throwable) {
        return new ManageFeignClient() {

            @Override
            public String getValue(String sysKey) {
                log.info("调用管理系统配置文件对应值失败");
                return null;
            }

            @Override
            public String localTrans(LocalTransRequestParam param) {
                log.info("调用三方服务翻译失败");
                return null;
            }
        };
    }
}
